﻿
Imports System.IO

#Const xmlversion = "1.0"

Public MustInherit Class xmlpage_base
    Inherits container

    Protected MustOverride Function xmlversion() As String

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff)

        Dim xml As xml = Nothing
        xml = New xml(buff)
        xml.version = xmlversion()
        xml.encoding = encoding.name.utf8
        addchild(xml)
    End Sub
End Class

Public Class xmlpage_1_0
    Inherits xmlpage_base

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff)
    End Sub

    Protected Overrides Function xmlversion() As String
        Return "1.0"
    End Function
End Class

Public Class xmlpage_1_1
    Inherits xmlpage_base

    Protected Overrides Function xmlversion() As String
        Return "1.1"
    End Function

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff)
    End Sub
End Class

Public Class xmlpage
#If xmlversion = "1.1" Then
    Inherits xmlpage_1_1
#Else
    Inherits xmlpage_1_0
#End If

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff)
    End Sub
End Class
